package com.web.managedbean;

import java.io.Serializable;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.primefaces.model.map.DefaultMapModel;
import org.primefaces.model.map.MapModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.logic.service.AdminService;
import com.logic.service.CompanyService;
import com.logic.service.UserService;


public abstract class AbstractManagedBean implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public Logger logger = LoggerFactory.getLogger(getClass());
	
	public MapModel emptyModel=new DefaultMapModel();
	
	
	@Autowired
	protected UserService userService;
	
	@Autowired
	protected AdminService adminService;
	
	@Autowired
	protected CompanyService companyService;
	
	
	
	public AbstractManagedBean() {
		//businessService = ServiceUtil.getInstance().getService();
	}
	
	public void addInfoMessage(String summary) {
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary,  "");
        FacesContext.getCurrentInstance().addMessage(null, message);
    }
	
	public void addErrorMessage(String summary) {
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, summary,  "");
        FacesContext.getCurrentInstance().addMessage(null, message);
    }
	
	public void addWarningMessage(String summary) {
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_WARN, summary,  "");
        FacesContext.getCurrentInstance().addMessage(null, message);
    }
	
	public void addMessage(FacesMessage message) {
		FacesContext.getCurrentInstance().addMessage(null, message);
	}
	
}
